import React from 'react';
import PropTypes from 'prop-types';
import transContainer from 'modules/common/transitionContainer';
import css from './index.less';

export default class Image extends React.Component {
  static propTypes = {
    mod: PropTypes.object.isRequired,
  };

  render() {
    const { mod } = this.props;
    const props = {
      // className: css.image,
      src: mod.src,
    };

    // 包装预制动效，必须传一个react组件
    const Node = transContainer(
      class extends React.Component {
        render() {
          return <img {...this.props} ref="node"/>;
        }
      }, mod, props);
    return <Node />;
  }
}
